<template>
  <div>
    <a-modal :visible="true" :footer="null" :width="700" @cancel="cancelEvent" class="orderModal">
      <div class="infoModal">详情编辑</div>
      <a-form-model ref="ruleForm" :model="newform" :label-col="labelCol" :wrapper-col="wrapperCol" :rules="rules" class="formVideoModel">
        <a-form-model-item ref="projectName" label="项目名称" prop="projectName">
          <a-input v-model="newform.projectName" @blur="() => {$refs.projectName.onFieldBlur(); }" />
        </a-form-model-item>
        <a-form-model-item label="区县" ref="country" prop="country">
          <a-select v-model="newform.country" placeholder="请选择区县" :disabled="disabled">
            <a-select-option value="">全部</a-select-option>
            <a-select-option value="鼓楼">鼓楼</a-select-option>
            <a-select-option value="马尾">马尾</a-select-option>
            <a-select-option value="台江">台江</a-select-option>
            <a-select-option value="晋安">晋安</a-select-option>
            <a-select-option value="仓山">仓山</a-select-option>
            <a-select-option value="长乐">长乐</a-select-option>
            <a-select-option value="福清">福清</a-select-option>
            <a-select-option value="闽侯">闽侯</a-select-option>
            <a-select-option value="罗源">罗源</a-select-option>
            <a-select-option value="闽清">闽清</a-select-option>
            <a-select-option value="连江">连江</a-select-option>
            <a-select-option value="平潭">平潭</a-select-option>
            <a-select-option value="永泰">永泰</a-select-option>
          </a-select>
        </a-form-model-item>
        <a-form-model-item ref="level" label="维护等级" prop="level">
          <a-select v-model="newform.level" placeholder="请选择维护等级">
            <a-select-option value="普通">普通</a-select-option>
            <a-select-option value="A">A</a-select-option>
            <a-select-option value="AA">AA</a-select-option>
            <a-select-option value="AAA">AAA</a-select-option>
          </a-select>

        </a-form-model-item>
        <a-form-model-item ref="number" label="资管编号" prop="number">
          <a-input v-model="newform.number" @blur="() => {$refs.number.onFieldBlur();}" />
        </a-form-model-item>

        <a-form-model-item ref="customer" label="客户名称" prop="customer">
          <a-input v-model="newform.customer" @blur="() => {$refs.customer.onFieldBlur();} " />
        </a-form-model-item>

        <a-form-model-item ref="customerArea" label="客户地址" prop="customerArea">
          <a-input v-model="newform.customerArea" @blur="() => {$refs.customerArea.onFieldBlur();}" />
        </a-form-model-item>

        <a-form-model-item ref="customerName" label="客户姓名" prop="customerName">
          <a-input v-model="newform.customerName" @blur="() => { $refs.customerName.onFieldBlur();}" />
        </a-form-model-item>

        <a-form-model-item ref="customerMobile" label="联系方式" prop="customerMobile">
          <a-input v-model="newform.customerMobile" @blur="() => { $refs.customerMobile.onFieldBlur(); }" />
        </a-form-model-item>

        <a-form-model-item ref="sceneUse" label="业务情况" prop="sceneUse">
          <a-select v-model="newform.sceneUse" placeholder="请选择业务情况">
            <a-select-option value="在用">在用</a-select-option>
            <a-select-option value="停用">停用</a-select-option>
          </a-select>
        </a-form-model-item>

        <a-form-model-item :wrapper-col="{ span: 10, offset: 10 }">
          <a-button type="primary" @click="onSubmit">
            提交
          </a-button>
          <a-button style="margin-left: 10px;" @click="onCancel">
            取消
          </a-button>
        </a-form-model-item>
      </a-form-model>

    </a-modal>
  </div>
</template>

<script>
import Vue from 'vue'
import { modifyVideo } from '@/api/video'
import { getUserRightAction } from '@/utils/util'
export default {
  props: ['newform', 'clickType'],
  data() {
    return {
      disabled:false,
      lodaing: false,
      labelCol: { span: 6 },
      wrapperCol: { span: 14 },
      dataSource: [],
      form: {},
      rules: {
        country: [{ required: true, message: '请输入区县', trigger: 'blur' }],
        customer: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
        customerArea: [{ required: true, message: '请输入客户地址', trigger: 'blur' }],
        customerMobile: [{ required: true, message: '请输入联系方式', trigger: 'blur' }],
        customerName: [{ required: true, message: '请输入客户姓名', trigger: 'blur' }],
        level: [{ required: true, message: '请输入维护等级', trigger: 'blur' }],
        number: [{ required: true, message: '请输入资管编号', trigger: 'blur' }],
        projectName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
        sceneUse: [{ required: true, message: '请输入业务情况', trigger: 'blur' }],
      },
    }
  },
  created() {
   let country = getUserRightAction()[0]
    country.length == 0 ? (this.disabled = false) : (this.disabled = true) 
  },
  mounted() {
  
  },
  methods: {
    onSubmit() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          this.$emit('updateMsg',this.newform)
        } else {
          return false
        }
      })
    },
    phoneCheck(rule, value, callbackFn) {
      const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
      if (!reg.test(value)) {
        callbackFn('手机号码格式不正确')
        return
      }
      callbackFn()
    },
    handleChange(e) {
      this.form.roleName = e
    },
    onCancel() {
      this.$emit('cancelEvent')
    },
    handleTableChange() {},
    addMember() {},
    cancelEvent() {
      this.$emit('cancelEvent')
    },
  },
}
</script>

<style lang="less">
.infoModal {
  height: 51px;
  background: rgba(255, 255, 255, 1);
  border-radius: 6px 6px 0px 0px;
  text-align: center;
  line-height: 51px;
  font-size: 18px;
  font-family: PingFang SC;
  font-weight: bold;
  color: rgba(0, 0, 0, 1);
}
</style>
